#include <iostream>
#include <list>
#include <map>
using namespace std;
// 就是括号匹配
// 已知
string s;
// 未知
list<char> l;
map<char, char> mp = {{')', '('}, {'>', '<'}, {']', '['}};

int main()
{
    cin >> s;
    for (auto c : s)
    {
        if (c == '(' or c == '<' or c == '[')
        {
            l.push_back(c);
        }
        else if(l.empty())
        {
            cout<<"No";
            return 0;
        }
        else if(mp[c] == l.back())
        {
            l.pop_back();
        }        
    }
    if(l.empty()) cout<<"Yes";
    else cout<<"No";
    return 0;
}